<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/WEB-INF/struts-tags.tld"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link id="favicon" href="/jxgl/favicon.ico" rel="icon" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>教练员</title>
<link rel="stylesheet" href="/jxgl/css/all.css" />
<link rel="stylesheet" href="/jxgl/css/login.css" />
<link rel="stylesheet" href="/jxgl/css/list.css" />
<script type="text/javascript" src="/jxgl/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/idvalidate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$.validator.setDefaults({       
		submitHandler: function(form) {    
			form.submit();
		}
	});
	jQuery.validator.addMethod("stringCheck", function(value, element) {       
		return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);       
	}, "只能包括中文字、英文字母、数字和下划线");
	jQuery.validator.addMethod("engCheck", function(value, element) {       
		return this.optional(element) || /^[\w]+$/.test(value);       
	}, "只能包括英文字母、数字和下划线");
	jQuery.validator.addMethod("chnCheck", function(value, element) {       
		return this.optional(element) || /^[\u0391-\uFFE5]+$/.test(value);       
	}, "只能包括中文字");
	jQuery.validator.addMethod("numCheck", function(value, element) {       
		return this.optional(element) || /^\d+$/.test(value);       
	}, "只能包括数字");
	jQuery.validator.addMethod("byteRangeLength", function(value, element, param) {       
		var length = value.length;
		for(var i = 0; i < value.length; i++){       
			if(value.charCodeAt(i) > 127){       
			length++;
			}       
		}
		return this.optional(element) || ( length >= param[0] && length <= param[1] );       
	}, "请确保输入的值在3-15个字节之间(一个中文字算2个字节)");
	jQuery.validator.addMethod("isIdCardNo", function(value, element) {       
		return this.optional(element) || IdCardValidate(value);       
	}, "请正确输入您的身份证号码");
	jQuery.validator.addMethod("isMobile", function(value, element) {       
		var length = value.length;   
		var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[02356789]{1}))+\d{8})$/;   
		return this.optional(element) || (length == 11 && mobile.test(value));       
	}, "请正确填写您的手机号码");	
	jQuery.validator.addMethod("isGoodAge", function(value, element) {
		var age = /^\d{1,2}$/;   
		return this.optional(element) || age.test(value);       
	}, "请正确填写年龄");
	$('#submitForm').validate({
		rules:{			
			realName:{
				required:true,
				chnCheck:true,
				byteRangeLength:[4,8]
			},			
			idCard:{
				required:true,
				isIdCardNo:true
			},
			vcode:{
				numCheck:true,
				byteRangeLength:[5,10]
			},
			licenseCode:{
				required:true,
				stringCheck:true,
				byteRangeLength:[10,15]
			},
			carCode:{
				required:true,
				stringCheck:true,
				byteRangeLength:[9,15]
			},
			age:{
				required:true,
				isGoodAge:true
			},
			address:{
				required:true,
				byteRangeLength:[4,40]
			},
			liveCity:{
				required:true,
				byteRangeLength:[4,20]
			},
			phone:{
				required:true,
				isMobile:true
			},
			note:{
				stringCheck:true,
				byteRangeLength:[0,100]
			}
		},
		messages:{			
			realName:{
				required:'请填写姓名',
				chnCheck:'只能包含中文字符',
				byteRangeLength:'字符数目在2-4'				
			},
			idCard:{
				required:'请输入身份证号码',
				isIdCardNo:'违规身份证号'
			},
			vcode:{
				numCheck:'格式不正确',
				byteRangeLength:'格式不正确'
			},
			licenseCode:{
				required:'不能为空',
				stringCheck:'格式不正确',
				byteRangeLength:'格式不正确'
			},
			carCode:{
				required:'不能为空',
				stringCheck:'格式不正确',
				byteRangeLength:'格式不正确'
			},
			age:{
				required:'请输入年龄',
				isGoodAge:'请输入合适的年龄'
			},
			address:{
				required:'请输入地址',
				byteRangeLength:'字符数目不超过20'
			},
			liveCity:{
				required:'请输入地址',
				byteRangeLength:'字符数目不超过20'
			},
			phone:{
				required:'请输入手机',
				isMobile:'手机号码格式不正确'
			},
			note:{
				stringCheck:"格式不正确",
				byteRangeLength:"不超过50个字符"
			}
		},
		focusInvalid: false,
		onkeyup: false,
		errorPlacement:function(error,element){
			error.appendTo(element.parent());
		}
	});
});
</script>
</head>
<body id="lg_body">
	<div id="lg_wrap">
		<div id="ln_header">
			<div class="header_logo_bg">
				<div class="header_link"> 
						<a target="_blank" href="http://www.changdajx.cn/%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC/"
						class="help_icon">问题咨询</a>&nbsp;&nbsp; 
						<a target="_blank"
						href="http://www.changdajx.cn"
						class="home_icon">驾校首页</a>&nbsp;&nbsp;
				</div>
			</div>
		</div>
		<div class="main_link" style="width: 960px; margin-top: 3px;">
			<a href="/jxgl/login"><b>首页</b></a> &gt; <font color="#666666">教练员</font>
		</div>
		<div id="ln_main" style="height: 860px; width: 960px;">
			<div id="left-column">
				<div class="widget-alt">
					<div class="headline no-margin">
						<h4>管理工具箱</h4>
					</div>
					<ul class="links-list-alt" style="padding-left: 0px">
						<li><a href="/jxgl/login">修改个人信息</a></li>						
                        <li><a href="/jxgl/changePic.jsp">修改头像</a></li>
						<li><a href="/jxgl/driver/editPwd">修改登录密码</a></li>
						<li><a href="/jxgl/driver/liststudent">我的学生</a></li>
						<li><a href="/jxgl/logout">退出登录</a></li>
					</ul>
				</div>
			</div>
			<div id="center-column">
				<div class="headline no-margin">
					<h4>编辑个人信息</h4>
				</div>
				<s:if test="msg != null">
	            <div class="notification success closeable" id="notification_1" style="display: block;margin-bottom:-10px">
				<p><span>提示!</span> <s:property value="msg"/></p></div>
				</s:if>
				<form action="/jxgl/driver/edit" method="POST" id="submitForm">
                    	<div class="user_login_table" style="height:630px;width:100%">
                    	<div class="username">
                            <div class="login_name">
                                用户名:
                            </div>
                            <div>
                                <input type="text" tabindex="1" disabled class="input_box" id="username" name="username" value="<s:property value="driver.name"/>">
                            </div>
                        </div>                        
                        <div class="username">
                            <div class="login_name">
                                真实姓名:
                            </div>
                            <div>
                                <input type="text" tabindex="1"  class="input_box" id="realName" name="realName" value="<s:property value="driver.realName"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                身份证号:
                            </div>
                            <div>
                                <input type="text" tabindex="1"  class="input_box" id="idCard" name="idCard" value="<s:property value="driver.idcard"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                准驾车型:
                            </div>
                            <div style="padding-top:5px">
                                <input type="text" tabindex="1"  disabled class="input_box" id="licenseType" name="licenseType" value="<s:property value="driver.licenseType"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                片区:
                            </div>
                            <div style="padding-top:5px">
                                <select name="region" class="input_box">										
										<option value="1" <s:if test="driver.driverRegion == 1">selected</s:if>>柳市</option>
										<option value="2" <s:if test="driver.driverRegion == 2">selected</s:if>>虹桥</option>
										<option value="3" <s:if test="driver.driverRegion == 3">selected</s:if>>乐成</option>
										<option value="4" <s:if test="driver.driverRegion == 4">selected</s:if>>大荆</option>
								</select>
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                虚拟网:
                            </div>
                            <div style="padding-top:5px">
                                <input type="text" tabindex="1"  class="input_box" id="vcode" name="vcode" value="<s:property value="driver.vcode"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                教练员证号:
                            </div>
                            <div style="padding-top:5px">
                                <input type="text" tabindex="1"  class="input_box" id="licenseCode" name="licenseCode" value="<s:property value="driver.licenseCode"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                教练车号:
                            </div>
                            <div style="padding-top:5px">
                                <input type="text" tabindex="1"  class="input_box" id="carCode" name="carCode" value="<s:property value="driver.carCode"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                年龄:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="age" name="age" value="<s:property value="driver.age"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                性别:
                            </div>
                            <div style="padding-top:5px">
                                <input type="radio" tabindex="1" id="gender" name="gender" value="1" <s:if test="driver.gender==1">checked</s:if>>男
                                <input type="radio" tabindex="1" id="gender" name="gender" value="2" style="padding-left:50px" <s:if test="driver.gender==2">checked</s:if>>女
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                家庭地址:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="address" name="address" value="<s:property value="driver.address"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                现居住地:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="liveCity" name="liveCity" value="<s:property value="driver.liveCity"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                                手机号码:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="phone" name="phone" value="<s:property value="driver.phone"/>">
                            </div>
                        </div>
                        <div class="username">
                            <div class="login_name">
                            特长介绍:
                            </div>
                            <div>
                                <textarea tabindex="1" class="input_box" style="height:40px" id="note" name="note"><s:property value="driver.note"/></textarea>
                            </div>
                        </div>
                        <div class="login_btn">                        	
							<input name="save" type="submit" value="保存" class="login_btn_style">
						</div>
					</div>
					</form>
			</div>
		</div>
	</div>
</body>
</html>